//Promise 基本示例
const promise = new Promise(function (resolve, reject) {
  // 这里用于兑现承诺
  resolve(100); //承诺达成
  reject(new Error("promise rejected")); //承诺失败
});

promise.then(
  function (value) {
    console.log("resolved", value);
  },
  function (error) {
    console.log("rejected", error);
  }
);
console.log("end");

Promise.resolve(1).then(2).then(Promise.resolve(3)).then(console.log);
